package Cain.led 
{
	import flash.display.Sprite;
	import flash.events.Event;
	/**
	 * 單燈LED 影格1關 影格2開
	 * @author Cain
	 */
	public class LED_2Light extends LED
	{
		public function LED_2Light()
		{
			setup();
		}
		/**
		 * 開關
		 */
		override public function set swich(_off:Boolean):void 
		{
			if (_off) 
			{
				gotoAndStop(2);
			}else 
			{
				gotoAndStop(1);
			}
		}
		override public function get swich():Boolean 
		{
			var _f:int = this.currentFrame;
			var _off:Boolean;
			if (_f==1) 
			{
				_off = false;
			}else 
			{
				_off = true;
			}
			return _off;
		}
		private function setup():void
		{
			addEventListener(Event.ADDED_TO_STAGE, onADDED_TO_STAGE);
		}
		private function onADDED_TO_STAGE(e:Event):void 
		{
			removeEventListener(Event.ADDED_TO_STAGE, onADDED_TO_STAGE);
			addEventListener(Event.REMOVED_FROM_STAGE, onREMOVED_FROM_STAGE);
			init();
		}
		private function init():void
		{
			addEventListeners();
		}
		
		private function addEventListeners():void
		{
			
		}
		private function removeEventListeners():void
		{
			
		}
		private function onREMOVED_FROM_STAGE(e:Event):void 
		{
			removeEventListener(Event.REMOVED_FROM_STAGE, onREMOVED_FROM_STAGE);
			removeEventListeners();
		}
	}
	
}